<template>
	<view class="u-p-28">
		<view class="bgw box-radius u-p-l-28 u-p-r-28">
			<u-radio-group v-model="radioValue" :wrap="true" style="display: block;" active-color="#117B12">
				<u-radio class="u-p-t-20 u-p-b-20 u-border-bottom" v-for="(item, index) in list" :key="index" :name="item.sid" :disabled="item.disabled">
					{{item.memberName}}
				</u-radio>
			</u-radio-group>
			<u-form :model="formData" ref="formRef" :label-width="150" :errorType="['toast']">
				<u-form-item :label="formLabel" prop="content" :border-bottom="false" label-position="top"
					input-align="left">
					<u-input v-model.trim="formData.content" placeholder="请输入取消原因" type="textarea"
						:auto-height="true" />
				</u-form-item>
			</u-form>
		</view>
		<u-gap height="20"></u-gap>
	</view>
	<u-gap height="140"></u-gap>
	<view class="fixed-bottom u-p-l-48 u-p-r-48 u-p-t-20 u-p-b-20 bgw">
		<u-button type="primary" :loading="loading" shape="circle" @click="submit">确定取消</u-button>
	</view>
</template>


<script setup>
	import store from '@/store/index.js'; //需要引入store
	import mixinOrder from '@/common/js/mixinOrder.js';
	import mixinList from '@/common/js/mixinList.js';
	import {
		ref,
		reactive,
		computed,
		getCurrentInstance
	} from 'vue'
	import {
		onReady,
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	import mixins from '@/common/js/mixins.js'; //需要引入store
	const {
		confirmOrder,
		cancelOrder 
	} = mixinOrder();
	const {
		total,
		current_page,
		page_size,
		last_page,
		apiPath,
		loading,
		list,
		searchParams,
		getList,
		getNextList,
		loadmoreStatus,
		searchClear,
		searchConfirm
	} = mixinList();
	const {
		proxy,
	} = getCurrentInstance()
	const {
		nav,
		navLogin,
		toastNavBack
	} = proxy.$util;
	const props = defineProps({
		sid: {
			type: [String, Number],
			default: '',
		}
	})
	const formLabel = '';
	page_size.value = 99;
	apiPath.value = 'getDictMembers';
	searchParams.dictKey = 'cancel'

	const radioValue = ref();
	const agreeFlag = ref(false)
	const formRef = ref()
	const formRules = {
		
	};
	const formData = reactive({
		content:''
	})
	const submit = (e) => {
		if (!radioValue.value) {
			uni.$u.toast('请选择取消类型');
			return false;
		}
		let data = {
			dictCancelSid:radioValue.value
		};
		formData.content && (data.content = formData.content)
		cancelOrder(props.sid,data,()=>{
			uni.$emit('order_update')
			setTimeout(()=>{
				uni.navigateBack()
			},1500)
		})
	}
	const getData = () => {
		if (!props.sid) {
			return;
		}
	}
	onReady(() => {
		// console.log(formRef);
		formRef.value.setRules(formRules);
	})
	onLoad((d) => {
		getList();
		getData();
	})
	onShow(() => {


	})
</script>

<style lang="scss" scoped>
	.fixed-bottom {
		width: 750rpx;
		background: #FFFFFF;
		box-shadow: 0rpx -4rpx 28rpx 0rpx rgba(202, 206, 208, 0.3);
	}
</style>